package com.woniuxy.orderassembly.controller;



import com.woniuxy.api.OrderDrawbackApi;
import com.woniuxy.common.Result;
import com.woniuxy.form.ModifyDrawbackForm;
import com.woniuxy.form.OrderDrawbackForm;
import com.woniuxy.orderassembly.service.IOrderDrawbackService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author chestnut
 * @since 2021-05-24
 */
@Slf4j
@RestController
public class OrderDrawbackController implements OrderDrawbackApi {
    @Resource
    private IOrderDrawbackService orderDrawbackService;

    @Override
    public Result creatOrderDrawback(OrderDrawbackForm orderDrawbackForm) {
        log.info("订单退款创建,{}",orderDrawbackForm);
        Result result = orderDrawbackService.addOrderDrawback(orderDrawbackForm);
        return Result.success(result);
    }

    @Override
    public Result modifyOrderDrawback(ModifyDrawbackForm modifyDrawbackForm) {
        log.info("订单退款创建,{}",modifyDrawbackForm);
        Result result = orderDrawbackService.modifyOrderDrawback(modifyDrawbackForm);
        return Result.success(result);
    }

    @Override
    public Result delOrderDrawback(Integer id) {
        log.info("订单退款创建删除,{}",id);
        Result result = orderDrawbackService.delOrderDrawback(id);
        return result;
    }

    @Override
    public Result pageOrderDrawback(Integer pageIdx) {
        log.info("分页展示订单退款表,{}",pageIdx);
        Result result = orderDrawbackService.pageOrderDrawback(pageIdx);
        return result;
    }

    @Override
    public Result pageOrderDrawbackByStatus(Integer pageIdx, Integer status) {
        log.info("状态分页展示订单退款表,{}",pageIdx);
        Result result = orderDrawbackService.pageOrderDrawbackByStatus(status,pageIdx);
        return result;
    }
}

